


import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

/**
 * Created by Dev on 13. 8. 12.
 */
public abstract class NetworkRequest {

	URL url;
	Object result;
	boolean isCancel;

	public interface OnProcessCompletedListener {
		void onCompleted(NetworkRequest request);
	}

	OnProcessCompletedListener mListener;

	public abstract Object getResult();
	abstract void parsing() ;

	void setUrl(String url) {
		try {
			this.url = new URL(url);
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
	}

	public void setOnCompleteListener(OnProcessCompletedListener listener) {
		this.mListener = listener;
	}

	boolean isCanceled() {
		return isCancel;
	}

	void process() {

		new Thread () {
			public void run() {		
				parsing();
			};
		}.start();
	}
}
